package com.twu.biblioteca;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by kashyapk on 25/02/14.
 */
public class Customer {
    private List<Book> books= new ArrayList<Book>();
    private List<Movie> movies = new ArrayList<Movie>();
    private String password;
    private String name;
    private String email;
    private String phone;

    Customer(String name, String password, String email, String phone) {
        this.password = password;
        this.name = name;
        this.email = email;
        this.phone = phone;
    }

    public String getName() {


        return name;
    }

    public String getPassword() {
        return password;
    }

    public String getEmail() {
        return email;
    }

    public String getPhone() {
        return phone;
    }

    public void CheckoutBook(Book book) {
        books.add(book);
    }

    public Book ReturnBook(String bookTitle) {
        for(Book book : books) {
            if(bookTitle.equals(book.GetTitle())){
                books.remove(book);
                return book;
            }
        }
        return null;
    }

    public void CheckoutMovie(Movie movie) {
        movies.add(movie);
    }

    public Movie ReturnMovie(String movieTitle) {
        for(Movie movie : movies) {
            if(movieTitle.equals(movie.getName())){
                books.remove(movie);
                return movie;
            }
        }
        return null;
    }
}
